<?php
/***************************************************************
*  Copyright notice
*  (c) 2009, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'frontend.main.class.php');
$feObj = new FrontendMainBase();

//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'module/product/product.category.class.php');
$pcObj = new ProductCategoryBase();
$pcObj->setQueryLimitLength(10);
$categories = $pcObj->getCategories();
$category = $pcObj->getCategory($request_link_class, 'link');
$feObj->addContent('categories', $categories);
$feObj->addContent('category', $category);

//
if( $category['categories_id'] > 0 ) {
	include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'module/product/product.class.php');
	$pObj = new ProductBase();
	$pObj->format = true;
	$filter = array('cid:=' => $category['categories_id']);
	$items = $pObj->getItems($filter, 0, true);
	$feObj->addContent('items', $items);
}

//
$feObj->addTitle($category['categories_name'], ' - ');
echo $feObj->display('pagelayout/pagelayout_main_category.tpl');
//
?>